home *** CD-ROM | disk | FTP | other *** search
/ Developer Helper 1: Phil & Dave's Excellent CD / Excellent CD HFS.raw / HyperCard / HyperCard 1.2.2 International / HyperCard Swedish (S-1.2.2) / Buntar / Version 1.2 nyheter / stack.txt < prev   
Text File  |  1989-01-05  |  8KB  |  273 lines

  1. -- stack: in.2 nyheter
  2. -- format: 8 (HyperCard 1)
  3. -- flags: 0x1000 (none)
  4. -- protect password hash: 0
  5. -- maximum user level: 5 (scripting)
  6. -- window: Rect(x1=0, y1=0, x2=0, y2=0)
  7. -- screen: Rect(x1=0, y1=0, x2=0, y2=0)
  8. -- card dimensions: w=0 h=0
  9. -- scroll: x=0 y=0
  10. -- background count: 3
  11. -- first background id: 5077
  12. -- card count: 31
  13. -- first card id: 4502
  14. -- list block id: 4142
  15. -- print block id: 3395
  16. -- font table block id: 0
  17. -- style table block id: 0
  18. -- free block count: 0
  19. -- free size: 0 bytes
  20. -- total size: 77856 bytes
  21. -- stack block size: 14848 bytes
  22. -- created by hypercard version: 0x00000000
  23. -- compacted by hypercard version: 0x01228000
  24. -- modified by hypercard version: 0x01228000
  25. -- opened by hypercard version: 0x01228000
  26. -- patterns[0]: 0x0000000000000000
  27. -- patterns[1]: 0x8000000008000000
  28. -- patterns[2]: 0x8800220088002200
  29. -- patterns[3]: 0x8888222288882222
  30. -- patterns[4]: 0x88AA22AA88AA22AA
  31. -- patterns[5]: 0xCCAA33AACCAA33AA
  32. -- patterns[6]: 0xEEAABBAAEEAABBAA
  33. -- patterns[7]: 0xEEBBBBEEEEBBBBEE
  34. -- patterns[8]: 0xFFBBFFEEFFBBFFEE
  35. -- patterns[9]: 0xFFBBFFFFFFBBFFFF
  36. -- patterns[10]: 0x8010022001084004
  37. -- patterns[11]: 0xFFFFFFFFFFFFFFFF
  38. -- patterns[12]: 0x8822882288228822
  39. -- patterns[13]: 0x1122448811224488
  40. -- patterns[14]: 0xC4800C6843023026
  41. -- patterns[15]: 0xB130031BD8C00C8D
  42. -- patterns[16]: 0xAA00AA00AA00AA00
  43. -- patterns[17]: 0x8822552288225522
  44. -- patterns[18]: 0x8855225588552255
  45. -- patterns[19]: 0x77DD77DD77DD77DD
  46. -- patterns[20]: 0x8000000000000000
  47. -- patterns[21]: 0xAA55AA55AA55AA55
  48. -- patterns[22]: 0x038448300C020101
  49. -- patterns[23]: 0x8244394482010101
  50. -- patterns[24]: 0x8814224188412214
  51. -- patterns[25]: 0x8080413E080814E3
  52. -- patterns[26]: 0x22048C7422179810
  53. -- patterns[27]: 0xBE808808EB088880
  54. -- patterns[28]: 0x25C8328964244C92
  55. -- patterns[29]: 0xA29C41BE2AC914EB
  56. -- patterns[30]: 0x40A00000040A0000
  57. -- patterns[31]: 0x8040200002040800
  58. -- patterns[32]: 0xAA00800088008000
  59. -- patterns[33]: 0xFF80808080808080
  60. -- patterns[34]: 0x081C22C180010204
  61. -- patterns[35]: 0xFF808080FF080808
  62. -- patterns[36]: 0xF87422478F172271
  63. -- patterns[37]: 0xBF00BFBFB0B0B0B0
  64. -- patterns[38]: 0xFF7FBE5DA2418000
  65. -- patterns[39]: 0xFAF5FAF5A050A050
  66. -- checksum: 0x0
  67. ----- HyperTalk script -----
  68. ‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚ÄîOpen and Close Stack handlers‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî
  69. on startUp
  70.   getHomeInfo
  71.   set userlevel to 5
  72. end startUp
  73.  
  74. on openStack
  75.   if the version < 1.2 then
  76.     answer "Denna bunt kr√§ver HyperCard version 1.2."
  77.     set lockMessages to TRUE
  78.     go home
  79.   else
  80.     global userHold,findNextList,pushList
  81.     lock screen
  82.     put the userLevel into userHold
  83.     set userLevel to 5
  84.     put empty into findNextList
  85.     put 0 into pushList
  86.     set loc of msg to 19,285
  87.     unlock screen
  88.   end if
  89. end openStack
  90.  
  91. on closeStack
  92.   global cardName,lastFind,userHold,findNext
  93.   set userLevel to userHold
  94.   --put empty into global vars used by this stack to release space:
  95.   put empty into cardName
  96.   put empty into lastFind
  97.   put empty into userHold
  98.   put empty into findNext
  99.   resetStack
  100.   set lockMessages to FALSE
  101. end closeStack
  102.  
  103. on doMenu command
  104.   if command is "first" or command is "next" or command is "prev" or command is "last" or command is "back" or command is "find..." then
  105.     cancelFindNext
  106.     cancelGoBack
  107.   end if
  108.   pass doMenu
  109. end doMenu
  110.  
  111. on arrowKey
  112.   cancelFindNext
  113.   pass arrowKey
  114. end arrowKey
  115.  
  116. on nextCard
  117.   cancelFindNext
  118.   cancelGoBack
  119.   visual effect scroll left
  120.   go next card
  121. end nextCard
  122.  
  123. on previousCard
  124.   cancelFindNext
  125.   cancelGoBack
  126.   visual effect scroll right
  127.   go previous card
  128. end previousCard
  129.  
  130. on resetStack
  131.   lock screen
  132.   cancelFindNext
  133.   cancelGoBack
  134.   if the number of this card is 1 then
  135.     cleanUpFirstCard
  136.   else
  137.     set lockRecent to TRUE
  138.     go first card
  139.     cleanUpFirstCard
  140.     go back
  141.     set lockRecent to FALSE
  142.   end if
  143. end resetStack
  144.  
  145. on cleanUpFirstCard
  146.   lock screen
  147.   show card field "kommentarer"
  148.   hide button id 8
  149.   hide button id 9
  150.   hide button "st√§ng"
  151.   hide card field "visa"
  152.   put empty into card field "visa"
  153.   unlock screen  with barn door close
  154. end cleanUpFirstCard
  155.  
  156. on cancelFindNext
  157.   global findNextList
  158.   hide bg btn "S√∂k n√§sta"
  159.   put empty into findNextList
  160. end cancelFindNext
  161.  
  162. on cancelGoBack
  163.   global pushList
  164.   hide bg btn "√Öterg√•"
  165.   put 0 into pushList
  166. end cancelGoBack
  167.  
  168. ————————————————————————————————————————————————————————————————————————
  169. Messages and functions for the find and find next buttons used in this
  170. stack.
  171. ————————————————————————————————————————————————————————————————————————
  172.  
  173. on myFind
  174.   global lastFind, findNextList
  175.   cancelFindNext
  176.   cancelGoBack
  177.  
  178.  
  179.   ask "S√∂kt text" with lastFind
  180.   if it is not empty then
  181.     hide bg btn "S√∂k n√§sta"
  182.     set cursor to busy
  183.     lock screen
  184.     put collectAllHits(it, "namn") into hits
  185.     if hits is empty then
  186.       answer "Text ej funnen."
  187.       unlock screen
  188.     else
  189.       put it into lastFind
  190.       get item 1 of hits
  191.       go card it
  192.       if the number of items in hits > 1 then
  193.         put "1," & lastFind & "," & hits into findNextList
  194.         show bg btn "Find Next"
  195.       end if
  196.       select empty
  197.       unlock screen
  198.     end if
  199.   end if
  200. end myFind
  201.  
  202. function collectAllHits text, fieldName
  203. repeat with i = 1 to 10000 --arbitrarily large number
  204.   find string text in field fieldName
  205.   if the result is "not found" then
  206.     --couldn't find it at all
  207.     return empty
  208.   else
  209.     --found it at least once
  210.     if i = 1 then
  211.       --first time found
  212.       put the id of this card into firstFind
  213.       put firstFind into result
  214.     else
  215.       --found it some more times
  216.       if the id of this card is firstFind then
  217.         --have come around to first find card
  218.         return result
  219.       else
  220.         --add card id to the result
  221.         put "," & the id of this card after result
  222.       end if
  223.     end if
  224.   end if
  225.   go next card --start looking from next card
  226.   set cursor to busy
  227. end repeat
  228. end collectAllHits
  229.  
  230. on findNext
  231.   global findNextList
  232.   lock screen
  233.   put the number of items of findNextList - 2 into max
  234.   put item 1 of findNextList into N
  235.   put item 2 of findNextList into text
  236.   if N = max then
  237.     put 1 into N
  238.   else
  239.     add 1 to N
  240.   end if
  241.   get item N + 2 of findNextList
  242.   hide bg btn "Find Next"
  243.   set cursor to watch
  244.   go it
  245.   show bg btn "Find Next"
  246.   find string text in field "namn"
  247.   unlock screen
  248.   put N into item 1 of findNextList
  249. end findNext
  250.  
  251. ‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚ÄîAuxiliary functions‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî
  252. These functions are called by various messages throughout all the
  253. scripts in this stack
  254. ————————————————————————————————————————————————————————————————————————
  255.  
  256. --function kwote takes a string as its argument and returns the
  257. --quoted version it (that is, with "" wrapped around it)
  258.  
  259. function kwote string
  260. return quote & string & quote
  261. end kwote
  262.  
  263. --function clickLine returns the line of the target field
  264. --over which the mouse was clicked.  It allows 4 pixels under the
  265. --baseline for the psychological effect of descenders.
  266.  
  267. function clickLine
  268. return ((the mouseV - item 2 of the rect of the target-4) div the textheight of the target) + 1
  269. end clickLine
  270.  
  271. ‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî*** End of File ***‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî‚Äî
  272.  
  273.